<div class="popup_body">
    <div class="ui_table">
        <form method="post">
            <input type="hidden" name="agentId" value="${Session['SESSION_KEY_USER'].agentId}">
            <input type="hidden" name="imagePath1" id="image_path1_${pid}">
            <input type="hidden" name="imagePath2" id="image_path2_${pid}">
            <input type="hidden" name="imagePath3" id="image_path3_${pid}">
            <input type="hidden" name="imagePath4" id="image_path4_${pid}">
            <table cellpadding="0" cellspacing="0">
                <tr>
                    <td width="70" align="right">商品名称：</td>
                    <td><input type="text" name="itemName" maxlength="20" class="text easyui-validatebox" required="true" /></td>
                    <td align="right">分类：</td>
                    <td>
                        <input name="categoryId" id="category_id_${pid}" class="easyui-combotree" readonly  required="true"  style="width: 184px; height: 28px;"
                               data-options="
                                       url:'${contextPath}/security/hdw/item_category/tree.htm?agentId=${Session['SESSION_KEY_USER'].agentId}'
                                       " value="">
                    </td>
                </tr>
                <tr>
                    <td align="right">状态：</td>
                    <td>
                            <span class="radio_box">
                                <input type="radio" class="radio" name="status" id="status_1" value="1"/><label for="status_1">下架</label>
                            </span>
                            <span class="radio_box">
                                <input type="radio" class="radio" name="status" id="status_2" checked value="2"/><label for="status_2">上架</label>
                            </span>
                    </td>
                    <td align="right">售出价(元)：</td>
                    <td><input class="text easyui-numberspinner" name="price" id="price_${pid}" required="true" data-options="min:0.01,precision:2" style="width: 184px; height: 28px;"/></td>
                </tr>
                <tr>
                    <td align="right">换电金额(元)：</td>
                    <td><input class="text easyui-numberspinner" name="exchangeMoney" id="price_${pid}" required="true" data-options="min:0.00,precision:2" style="width: 184px; height: 28px;" value="0"/></td>
                    <td align="right">显示价格(元)：</td>
                    <td><input class="text easyui-numberspinner" name="showPrice" id="price_${pid}" required="true" data-options="min:0.01,precision:2" style="width: 184px; height: 28px;"/></td>
                </tr>
                <tr>
                    <td align="right">备注：</td>
                    <td colspan="3"><textarea style="width:435px; height:50px;"  maxlength="256"name="introduction">${(entity.content)!''}</textarea></td>
                </tr>
                <tr>
                    <td align="right">商品图片：</td>
                    <td colspan="3 ">
                        <div class="image1 portrait" style="float: left; margin-right: 10px;" num="1">
                            <a href="javascript:void(0)"><img id="image_1_${pid}" src="${app.imagePath}/default_item.png" /><span>修改图片</span></a>
                        </div>
                        <div class="image2 portrait" style="float: left; margin-right: 10px;" num="2">
                            <a href="javascript:void(0)"><img id="image_2_${pid}" src="${app.imagePath}/default_item.png" /><span>修改图片</span></a>
                        </div>
                        <div class="image3 portrait" style="float: left; margin-right: 10px;" num="3">
                            <a href="javascript:void(0)"><img id="image_3_${pid}" src="${app.imagePath}/default_item.png" /><span>修改图片</span></a>
                        </div>
                        <div class="image4 portrait" style="float: left; margin-right: 10px;" num="4">
                            <a href="javascript:void(0)"><img id="image_4_${pid}" src="${app.imagePath}/default_item.png" /><span>修改图片</span></a>
                        </div>
                    </td>
                </tr>

            </table>
        </form>
    </div>
</div>
<div class="popup_btn">
    <button class="btn btn_red ok">确定</button>
    <button class="btn btn_border close">关闭</button>
</div>
<script>
    function upload_image_callback(param) {
        $('#image_' + param.num + '_${pid}').attr('src', '${controller.appConfig.staticUrl}' + param.filePath);
        $('#image_path' + param.num + '_${pid}').val(param.filePath);
        $('#' + param.pid).window('close');
    }
    (function() {
        var pid = '${pid}',
                win = $('#' + pid),
                form = win.find('form');

        win.find('button.ok').click(function() {
            form.form('submit', {
                url: '${contextPath}/security/hdw/item/create.htm',
                onSubmit: function(){
                    if(!form.form('validate')) {
                        return false;
                    }

                    return true;
                },
                success: function(text) {
                    var json = $.evalJSON(text);
                    <@app.json_jump/>
                    if(json.success) {
                        $.messager.alert('提示信息', '操作成功', 'info');
                        win.window('close');
                    } else {
                        $.messager.alert('提示信息', json.message, 'info');
                    }
                }
            });
        });
        win.find('button.close').click(function() {
            win.window('close');
        });
        win.find('.portrait').click(function() {
            var num = $(this).attr('num');
            App.dialog.show({
                css: 'width:558px;height:150px;overflow:visible;',
                title: '上传图片',
                href: "${contextPath}/security/hdw/item/image.htm?num=" + num,
                event: {
                    onClose: function() {
                    }
                }
            });
        });

    })()
</script>